# Maintainer: Milan P. Stanić <mps@arvanta.net>
pkgname=fwknop
pkgver=2.6.10
pkgrel=5
pkgdesc="Single Packet Authorization (SPA) implementation"
url="https://cipherdyne.org/fwknop/"
arch="all"
license="GPL-2.0-or-later"
depends="iptables"
makedepends="libpcap-dev gpgme-dev"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs $pkgname-openrc $pkgname-server"
source="http://cipherdyne.org/fwknop/download/fwknop-$pkgver.tar.gz
	fwknopd.initd
	fwknopd.confd
	gcc10.patch
	"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--disable-static \
		--with-gpgme
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm755 "$srcdir"/fwknopd.initd "$pkgdir"/etc/init.d/fwknopd
	install -Dm755 "$srcdir"/fwknopd.confd "$pkgdir"/etc/conf.d/fwknopd
}

server() {
	pkgdesc="Single Packet Authorization (SPA) server"
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/sbin "$subpkgdir"/usr/ \
		&& mv "$pkgdir"/etc "$subpkgdir"/
}

sha512sums="
3b3e35eda574abd1759431c88677eea7078c54cb3252c0ee0e1019b5b8224ed8844d30760da70a952e1cd92b04715a547f6effabda54678f791fff9afa32cd80  fwknop-2.6.10.tar.gz
eb20a697aabc6d114602243afa1a799d9441e4b70fe37c1ed1ee4e4a23b117537c3a199a454070b039c1370221de619bf4da47f050153d41e5dca4853b215b7b  fwknopd.initd
9b975bdc735753260f55ab67b8bc99675246a22e096984de28a20d6bddfc042b709c7d7bd02974f84d45de0a1e34be94e94b71faf43d7e133e0ff259c562b406  fwknopd.confd
e045c0936ea03e0f472e3bee7911c01e6ec16b51231f572ec943e1bff5a7e8e5d57739c040affe4d77f6b463d29e52bbe035e9f84a1e03c9a1de9b4c50b27e21  gcc10.patch
"
